package com.burstly.jackson.map.ser.std;

import com.burstly.jackson.JsonGenerationException;
import com.burstly.jackson.JsonGenerator;
import com.burstly.jackson.JsonNode;
import com.burstly.jackson.map.JsonMappingException;
import com.burstly.jackson.map.JsonSerializer;
import com.burstly.jackson.map.SerializationConfig.Feature;
import com.burstly.jackson.map.SerializerProvider;
import com.burstly.jackson.map.annotate.JacksonStdImpl;
import com.burstly.jackson.node.JsonNodeFactory;
import com.burstly.jackson.node.ObjectNode;
import com.burstly.jackson.schema.SchemaAware;
import com.burstly.jackson.type.JavaType;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;

public abstract class SerializerBase<T> extends JsonSerializer<T>
  implements SchemaAware
{
  protected final Class<T> _handledType;

  protected SerializerBase(JavaType paramJavaType)
  {
    this._handledType = paramJavaType.getRawClass();
  }

  protected SerializerBase(Class<T> paramClass)
  {
    this._handledType = paramClass;
  }

  protected SerializerBase(Class<?> paramClass, boolean paramBoolean)
  {
    this._handledType = paramClass;
  }

  protected ObjectNode createObjectNode()
  {
    return JsonNodeFactory.instance.objectNode();
  }

  protected ObjectNode createSchemaNode(String paramString)
  {
    ObjectNode localObjectNode = createObjectNode();
    localObjectNode.put("type", paramString);
    return localObjectNode;
  }

  protected ObjectNode createSchemaNode(String paramString, boolean paramBoolean)
  {
    ObjectNode localObjectNode = createSchemaNode(paramString);
    if (!paramBoolean)
      if (!paramBoolean)
        break label27;
    label27: for (boolean bool = false; ; bool = true)
    {
      localObjectNode.put("required", bool);
      return localObjectNode;
    }
  }

  public JsonNode getSchema(SerializerProvider paramSerializerProvider, Type paramType)
    throws JsonMappingException
  {
    return createSchemaNode("string");
  }

  public final Class<T> handledType()
  {
    return this._handledType;
  }

  protected boolean isDefaultSerializer(JsonSerializer<?> paramJsonSerializer)
  {
    return (paramJsonSerializer != null) && (paramJsonSerializer.getClass().getAnnotation(JacksonStdImpl.class) != null);
  }

  public abstract void serialize(T paramT, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
    throws IOException, JsonGenerationException;

  public void wrapAndThrow(SerializerProvider paramSerializerProvider, Throwable paramThrowable, Object paramObject, int paramInt)
    throws IOException
  {
    while (true)
    {
      if ((!(paramThrowable instanceof InvocationTargetException)) || (paramThrowable.getCause() == null))
      {
        if (!(paramThrowable instanceof Error))
          break;
        throw ((Error)paramThrowable);
      }
      paramThrowable = paramThrowable.getCause();
    }
    if ((paramSerializerProvider != null) && (!paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRAP_EXCEPTIONS)));
    for (int i = 0; (paramThrowable instanceof IOException); i = 1)
    {
      if ((i != 0) && ((paramThrowable instanceof JsonMappingException)))
        break label98;
      throw ((IOException)paramThrowable);
    }
    if ((i == 0) && ((paramThrowable instanceof RuntimeException)))
      throw ((RuntimeException)paramThrowable);
    label98: throw JsonMappingException.wrapWithPath(paramThrowable, paramObject, paramInt);
  }

  public void wrapAndThrow(SerializerProvider paramSerializerProvider, Throwable paramThrowable, Object paramObject, String paramString)
    throws IOException
  {
    while (true)
    {
      if ((!(paramThrowable instanceof InvocationTargetException)) || (paramThrowable.getCause() == null))
      {
        if (!(paramThrowable instanceof Error))
          break;
        throw ((Error)paramThrowable);
      }
      paramThrowable = paramThrowable.getCause();
    }
    if ((paramSerializerProvider != null) && (!paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRAP_EXCEPTIONS)));
    for (int i = 0; (paramThrowable instanceof IOException); i = 1)
    {
      if ((i != 0) && ((paramThrowable instanceof JsonMappingException)))
        break label98;
      throw ((IOException)paramThrowable);
    }
    if ((i == 0) && ((paramThrowable instanceof RuntimeException)))
      throw ((RuntimeException)paramThrowable);
    label98: throw JsonMappingException.wrapWithPath(paramThrowable, paramObject, paramString);
  }

  @Deprecated
  public void wrapAndThrow(Throwable paramThrowable, Object paramObject, int paramInt)
    throws IOException
  {
    wrapAndThrow(null, paramThrowable, paramObject, paramInt);
  }

  @Deprecated
  public void wrapAndThrow(Throwable paramThrowable, Object paramObject, String paramString)
    throws IOException
  {
    wrapAndThrow(null, paramThrowable, paramObject, paramString);
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.jackson.map.ser.std.SerializerBase
 * JD-Core Version:    0.6.2
 */